home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 7_10.lha / 7_10 / p_cons.c < prev    next >
C/C++ Source or Header  |  1993-08-08  |  2KB  |  54 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include <process.h>
  6. include <stackdir.h>
  7. include <debug.h>    /* DELETE */
  8.  
  9. tatic char _tmpmainprocess;
  10. tatic process *const tmpmainprocess = (process*)&_tmpmainprocess;
  11.  
  12. rocess::process(char *nname)
  13.  
  14.    // set the local variables
  15.    t_name = nname ? nname : "no-name";
  16.    if (debug) /*DELETE*/ cerr << "process" << this << "::process(" << (nname ? nname : "NULL") << ")\n";
  17.    if (debug) /*DELETE*/ cerr << "\tprocess: thisprocess == " << t_thisprocess << "\n";
  18.    if (debug) /*DELETE*/ cerr << "\tprocess: t_mainprocess == " << t_mainprocess << "\n";
  19.    t_stack = 0;
  20.    t_stacksize = 0;
  21.    t_result = 1;
  22.    t_priority = 0;
  23.    t_next = 0;
  24.    t_desiredtime = 0;
  25.    t_curstate = TASK_IDLE;
  26.  
  27.    // create a process for main()
  28.    if (!t_mainprocess)
  29. {
  30. if (debug) /*DELETE*/ cerr << "\tcreate main process\n";
  31. t_mainprocess = tmpmainprocess;
  32. t_thisprocess = t_mainprocess = new process("main");
  33. if (debug) /*DELETE*/ cerr << "\tmainprocess <- " << t_mainprocess << "\n";
  34. }
  35.  
  36.    if (debug) /*DELETE*/ cerr << "<<<< process" << this << "::process()\n";
  37.  
  38.                                 // DELETE
  39. stream &process::print(ostream &out)                    // DELETE
  40.                                     // DELETE
  41.    if (this)                                // DELETE
  42. {                                // DELETE
  43. out << "[";                            // DELETE
  44. if (debug>1) out << form("%#x", this) << ",";            // DELETE
  45. if (this == tmpmainprocess)                    // DELETE
  46.     out << "tmpmainprocess]";                    // DELETE
  47. else                                // DELETE
  48.     out << this->t_name << "]";                    // DELETE
  49. }                                // DELETE
  50.    else                                // DELETE
  51. out << "[NULL]";                        // DELETE
  52.    return out;                                // DELETE
  53.                                     // DELETE
  54.